package demo7;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


@Component
public class Person implements InitializingBean {
    private String name;

    public Person()
    {
        System.out.println("1:Person()的构造器执行了");
    }
    @Value("张三")
    public void setName(String name)
    {
        System.out.println("2:初始化name属性，setName()方法执行了");
        this.name = name;
    }

    public void paly(){
        System.out.println("3:play()方法执行");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("person对象被容器完整初始化完毕了");
    }
}
